// 通过房东要把房子通过中介租出去来理解代理模式

#include <iostream>

class RentHouse
{
public:
    virtual void rentHouse() = 0;
};

// 房东类
class Landlord : public RentHouse
{
public:
    void rentHouse() override
    {
        std::cout << "将房子租出去\n";
    }
};

// 中介代理类
class Intermediary : public RentHouse
{
public:
    void rentHouse() override
    {
        std::cout << "发布招租启示\n";
        std::cout << "带人看房\n";
        _landlord.rentHouse();
        std::cout << "负责租后维修\n";
    }

private:
    Landlord _landlord;
};

int main()
{
    Intermediary intermediary;

    intermediary.rentHouse(); // 通过中介来出租房子

    return 0;
}